<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>

<rich:panel header="#{messages['booking.label']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
	</h:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{!(adminRCIBookingBean.lookupForm || adminRCIBookingBean.lookupPartnerForm)}">
		<h:panelGroup>
		    <h:outputText value="#{messages['rci.booking.label']}" styleClass="sub_header" />
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>
	
	<t:panelGrid rendered="#{!(adminRCIBookingBean.lookupForm || adminRCIBookingBean.lookupPartnerForm)}" columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputLabel  for="bookingNo" value="#{messages['booking.no.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.rciBookingNo}">
		</t:inputText>
		
		<h:outputLabel  for="bookingDate" value="#{messages['booking.no.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingDate" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.rciBookingDate}">
			<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
		</t:inputText>
		
		<h:outputLabel  for="bookingStatus" value="#{messages['booking.status.label']}" styleClass="standardText_Label" />
		<t:inputText  id="bookingStatus" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.status}">
		</t:inputText>
	
		<h:outputLabel  for="rciNo" value="#{messages['rci.member.rci.no.label']}" styleClass="standardText_Label" />
		<t:inputText  id="rciNo" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.rciMember.rciNo}">
		</t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="guestName" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="guestName" value="#{messages['guest.name.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<t:inputText id="guestName" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.guestName}"></t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="partnerCode" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="partnerCode" value="#{messages['partner.code.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    <h:inputText size="20" maxlength="20" readonly="true" value="#{adminRCIBookingBean.partner.code}" required="true"></h:inputText>
			<h:commandButton value="#{messages['search']}" styleClass="button" action="null" actionListener="#{adminRCIBookingBean.lookupPartnerFormActionEvent}" immediate="true">
			</h:commandButton>
			<h:inputHidden required="true" id="partnerCode" value="#{adminRCIBookingBean.partner.code}"></h:inputHidden>
		</h:panelGroup>
		
		<h:outputLabel  for="partnerName" value="#{messages['partner.name.label']}" styleClass="standardText_Label" />
		<t:inputText  id="partnerName" readonly="true" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.partner.compName}">
		</t:inputText>
		
		<h:outputText></h:outputText>
		<t:message for="checkIn" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkIn" value="#{messages['booking.checkin.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    	<t:inputCalendar
		    	id="checkIn"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminRCIBookingBean.rciBooking.checkInDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	</t:inputCalendar>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="checkOut" styleClass="error"></t:message>
		<h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="checkOut" value="#{messages['booking.checkout.label']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
		    	<t:inputCalendar
		    	id="checkOut"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminRCIBookingBean.rciBooking.checkOutDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="true"
		    	>
		    	</t:inputCalendar>
		</h:panelGroup>
		
		<h:outputLabel for="noOfRooms" value="#{messages['rci.booking.no.of.rooms.label']}" styleClass="standardText_Label" />
		<t:inputText id="noOfRooms" required="true" size="3" maxlength="3" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.noOfRooms}"></t:inputText>
		
		<h:outputLabel for="confirmationNo" value="#{messages['booking.confirmation.no.label']}" styleClass="standardText_Label" />
		<t:inputText id="confirmationNo" required="false" size="20" maxlength="20" styleClass="standardText" value="#{adminRCIBookingBean.rciBooking.confirmationNo}"></t:inputText>
		
		<h:outputLabel for="confirmationDate" value="#{messages['booking.confirmation.date.label']}" styleClass="standardText_Label" />
		<t:inputCalendar
		    	id="confirmationDate"
					monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
					currentDayCellClass="currentDayCell" value="#{adminRCIBookingBean.rciBooking.confirmationDate}"
					renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
					popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
					renderPopupButtonAsImage="true"
					styleClass="standardText" required="false"
		    	>
		    	</t:inputCalendar>
		
		
		<h:outputLabel for="remark" value="#{messages['booking.remark.label']}" styleClass="standardText_Label" />		
		<t:inputTextarea styleClass="standardText" cols="20" rows="5" value="#{adminRCIBookingBean.rciBooking.remark}"></t:inputTextarea>
		
		<rich:spacer height="10"></rich:spacer>
		
		<t:panelGroup>
		   <t:panelGrid columns="2">
		   		<h:commandButton value="#{messages['update']}" styleClass="button" action="#{adminRCIBookingBean.updateRCIBookingAction}" actionListener="#{adminRCIBookingBean.updateRCIBookingActionEvent}"></h:commandButton>
			    <h:commandButton value="#{messages['back']}" styleClass="button" action="#{adminRCIBookingBean.initRCIBookingAction}" immediate="true"></h:commandButton>
		   </t:panelGrid>
		</t:panelGroup>
	</t:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{!adminRCIBookingBean.lookupPartnerForm}" columns="1">
			<h:commandButton value="#{messages['add.rci.bulkbank.button']}" styleClass="button" action="#{adminRCIBookingBean.navAddRCIBookingDetailAction}" actionListener="#{adminRCIBookingBean.navAddRCIBookingDetailActionEvent}"></h:commandButton>
			
			<rich:dataTable id="dataRCIBookingDetail" var="rciBookingDetail" value="#{adminRCIBookingBean.rciBookingDetailList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.bulk.bank.partner.code.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciBookingDetail.rciBulkBank.partnerProduct.partner.code}"></h:outputText>
				</rich:column>
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.bulk.bank.product.code.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciBookingDetail.rciBulkBank.partnerProduct.code}"></h:outputText>
				</rich:column>
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.bulk.bank.room.1.no.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciBookingDetail.rciBulkBank.room1No}"></h:outputText>
				</rich:column>
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.bulk.bank.room.2.no.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciBookingDetail.rciBulkBank.room2No}"></h:outputText>
				</rich:column>
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.bulk.bank.max.pax.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciBookingDetail.rciBulkBank.maxPax}"></h:outputText>
				</rich:column>
			</rich:dataTable>	
	</h:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{adminRCIBookingBean.lookupPartnerForm}" columns="1">
		<h:outputText value="#{messages['partner.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="dataPartner" var="partner" value="#{adminRCIBookingBean.partnerList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['partner.code.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminRCIBookingBean.navAddRCIBookingAction}" actionListener="#{adminRCIBookingBean.lookupPartnerFormSelectedActionEvent}">
						<h:outputText value="#{partner.code}"></h:outputText>
					</h:commandLink>
					<f:param id="partnerId" value="#{partner.partnerId}" />
				</rich:column>
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['partner.name.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminRCIBookingBean.navAddRCIBookingAction}" actionListener="#{adminRCIBookingBean.lookupPartnerFormSelectedActionEvent}">
						<h:outputText value="#{partner.compName}"></h:outputText>
					</h:commandLink>
				</rich:column>
		</rich:dataTable>
	</h:panelGrid>
	
	<h:panelGrid width="100%" rendered="#{adminRCIBookingBean.lookupForm}" columns="1">
		<h:outputText value="#{messages['rci.member.lookup.label']}" styleClass="sub_header" />
		
		<rich:dataTable id="data" var="rciMember" value="#{adminRCIBookingBean.rciMemberList}" rows="20" width="99%">
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.member.rci.no.column']}"></h:outputText>
					</f:facet>
				
					<h:commandLink action="#{adminRCIBookingBean.navAddRCIBookingAction}" actionListener="#{adminRCIBookingBean.lookupRCIMemberFormSelectedActionEvent}">
						<h:outputText value="#{rciMember.rciNo}"></h:outputText>
					</h:commandLink>
					<f:param id="rciMemberId" value="#{rciMember.rciMemberId}" />
				</rich:column>	
				
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['membership.no.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.member.membershipNo}"></h:outputText>
				</rich:column>
						
				<rich:column style="text-align:center;width:30%;">
					<f:facet name="header">
						<h:outputText value="#{messages['rci.enrollment.date.column']}"></h:outputText>
					</f:facet>
					<h:outputText value="#{rciMember.enrollmentDate}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="Asia/Kuala_Lumpur"/>
					</h:outputText>
				</rich:column>
				
			</rich:dataTable>
					
			<rich:spacer height="10"></rich:spacer>
					
			<rich:datascroller align="left"  for="data" maxPages="20" />
			
			<h:commandButton value="#{messages['back']}" styleClass="button" action="null" actionListener="#{adminRCIBookingBean.lookupRCIMemberFormCloseActionEvent}" immediate="true">
			</h:commandButton>
	</h:panelGrid>
	
</rich:panel>
